Skip to content

To string quote #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 31, 2014
Merged

To string quote #101

merged 3 commits into from
Jul 31, 2014

Conversation

theengineear
Copy link
Contributor

Some reformatting for the to_string method for graph objects.

before:

            text=[u'4179 Toutatis<br>Radius: 2188 meters <br> Velocity: 11....],

after:

            text=[u'4179 Toutatis<br>Radius: 2188 meters <br> Velocity: 1...'],

additionally:

* the end of line (eol) is considered in max len
* the conditional comma is considered in max len
* lines >= to max line length are guaranteed to equal max line length!
* to do the above, spaces, ' ', are filled as necessary.
Also, you have to ensure that the sublist is longer than "[...]".
Where "..." == end.

Otherwise, you might end up with: ", ...]". Where we're closing
something that we no longer open!
Higher chance that we see the end returned.
@theengineear
Copy link
Contributor Author

@etpinard, this should fix your quoties issue. It also fixes the closing of lists of lists (which i noticed later)

there's a chance that something strange could pop up for ndarrays, like if you had an ndarray of strings... not even sure if you can do that or why you would.

for normal lists things should look better.

@etpinard
Copy link
Contributor

image

Looks like the ... disappeared from the list of strings.

Whether it's on purpose or not, this is a nice workaround.

@theengineear
Copy link
Contributor Author

yup, it's because adding "'..'" is 4 characters, which would go over the maximum width. To deal with this, the excess space is just filled with " " (spaces).
also, it's no longer "..." it's ".." to attempt to have this happen less.

@etpinard
Copy link
Contributor

I like it 👍

@theengineear
Copy link
Contributor Author

cool. merging!

theengineear added a commit that referenced this pull request Jul 31, 2014
@theengineear theengineear merged commit b50b491 into master Jul 31, 2014
@theengineear theengineear deleted the to-string-quote branch July 31, 2014 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants